<template>
	<view :style="{ paddingTop: safeAreaTop + 'px' }">
		<up-navbar title="档案列表" :autoBack="true" />
		<view class="mt-2 pl-2 pr-2">
			<view class="flex-r s-b a-c">
				<up-search v-model="searchKeyword" placeholder="搜索档案" :showAction='false' shape="square"
					bgColor="#F9F9F9" height="40" />
				<text class="iconfont-color icon-shoucang ml-1"
					@click="handleTo('/pages/home/components/archivesManagement/addOrEdit?updateId=1')" />
			</view>
			<view class="flex-r mt-2 filter" @click="showCateTab = !showCateTab">
				筛选项 <up-icon name="arrow-down" />
			</view>
			<up-cate-tab v-show="showCateTab" class="cate-tab" :tabList="cateList" tabKeyName="title"
				itemKeyName="title">
				<template #pageItem="{pageItem}">
					<view class="w-full">
						<up-cell-group :border='false'>
							<up-cell :border='false'>
								<template v-slot:title>
									<view class="tab-item">
										{{ pageItem.title }}
									</view>
								</template>
							</up-cell>
						</up-cell-group>
					</view>
				</template>
			</up-cate-tab>
		</view>
		<view class="">
			<view class="archives-item flex-r s-b a-c" @click="handleTo('/pages/home/components/personalMap/personal')">
				<view class="flex-r a-c">
					<up-avatar text="北" fontSize="18" randomBgColor />
					<view class="ml-1">
						<view class="flex-r personal">
							<view>自己</view>
							<text class="iconfont icon-nan ml-1 mr-1" />
							<text>1999.12.21</text>
						</view>
						<view class="flex-r report">
							显化生产者 · 荐骨权威 · 2/4 · 二分人
						</view>
					</view>
				</view>
				<view class="" @click.stop="handleTo('/pages/home/components/archivesManagement/addOrEdit?updateId=2')">
					<up-icon name="edit-pen" size=30 color="#DCDCDC" />
				</view>
			</view>
		</view>


	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue'
	
	const safeAreaTop = uni.$safeArea?.safeAreaTop || 44;

	const memberList = ref([])
	const searchKeyword = ref('')
	// 响应式数据  
	const cateId = ref('')
	const cateList = ref([{
			title: '能量类型',
			children: [{
				title: '生产者',
			}, {
				title: '反应者',
			}, {
				title: '投射者',
			}, {
				title: '显化者',
			}, {
				title: '显化生产者',
			}]
		},
		{
			title: '人生角色',
			children: [{
				title: '1/4',
			}, {
				title: '1/4',
			}, {
				title: '2/5',
			}, {
				title: '3/5',
			}, {
				title: '3/6',
			}, {
				title: '4/6',
			}]
		},
		{
			title: '内在指引',
			children: []
		},
		{
			title: '决策模式',
			children: []
		},
	])
	const showCateTab = ref(false)

	// 方法  
	const selectItem = (item) => {
		console.log(item);
	};

	const handleTo = (url) => {
		uni.navigateTo({
			url
		})
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-select__text {
		font-size: 24rpx;
		color: #4D4D4D;
	}

	::v-deep .u-cell__body {
		padding: 10rpx;
	}

	.cate-tab {
		position: absolute;
		z-index: 1;
		height: 80vh;

		.tab-item {
			font-size: 28rpx;
			color: #6F6F6F;
			padding: 14rpx 40rpx;
			border: 1px solid #A6A6A6;
			border-radius: 34rpx;
		}
	}

	.filter {
		font-size: 24rpx;
		color: #4D4D4D;
	}

	.archives-item {
		padding: 30rpx 40rpx;
		box-shadow: 0px 1px 0px 0px #EEEEEE;
	}

	.personal {
		view {
			font-size: 32rpx;
			font-weight: bold;
		}

		text,
		.iconfont {
			font-size: 24rpx;
			color: #4D4D4D;
			background-color: #EEEEEE;
			border-radius: 18rpx;
			padding-top: 8rpx;
			padding-left: 6rpx;
			padding-right: 6rpx;
		}

		.iconfont {
			font-size: 20rpx;
		}
	}

	.report {
		font-size: 20rpx;
		color: #797979;
		margin-top: 8rpx;
	}

	.iconfont-color {
		font-size: 64rpx;
	}
</style>